#
#	Copyright (C) 2014  Julio Montes, Mario Carrillo
#	
#	Julio Montes e-mail: imc.coder@gmail.com 
#
#	Mario Carrillo e-mail: mario_90ago@live.com.mx
#
#	BSD 3-Clause License
#

cmake_minimum_required(VERSION 2.8.11)
project(ideall)

if(CMAKE_BUILD_TYPE MATCHES DEBUG)
	set(IDEALL ideall_debug)
	set(TINYXML2 tinyxml2_debug)
	set(WXSCINTILLA wxscintilla_debug)
	set(SDK sdk_debug)
	set(ALLIANCE alliance_debug)
else()
	set(IDEALL ideall)
	set(TINYXML2 tinyxml2)
	set(WXSCINTILLA wxscintilla)
	set(SDK sdk)
	set(ALLIANCE alliance)
endif()

set(CMAKE_SKIP_BUILD_RPATH TRUE)

set(CMAKE_C_COMPILER gcc)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -DUSE_RICHTEXTCTRL")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -DSDK_DEBUG -DIDEALL_DEBUG -DUSE_RICHTEXTCTRL")

set(CMAKE_SHARED_LINKER_FLAGS  "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic")

set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -DUSE_RICHTEXTCTRL")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -DSDK_DEBUG -DUSE_RICHTEXTCTRL")

if(WX_INSTALLED)
	set(WX_INCLUDE_DIRS ${WX_INSTALLED_INCLUDE_DIRS})
	set(WX_LINK_DIRS "")
else()
	set(WX_INCLUDE_DIRS
		${PROJECT_SOURCE_DIR}/libs/wx-2.9.5/include/wx-2.9
		${PROJECT_SOURCE_DIR}/libs/wx-2.9.5/lib/wx/include/gtk2-unicode-2.9
	)
	set(WX_LINK_DIRS
		${PROJECT_SOURCE_DIR}/libs/wx-2.9.5/lib
	)
endif()

link_directories(
	${PROJECT_SOURCE_DIR}/libs/tinyxml2/lib
	${PROJECT_SOURCE_DIR}/libs/wxscintilla/lib
	${WX_LINK_DIRS}
)


#
#tinyxml2
#
set(TINYXML2_HEADER_DIR ${PROJECT_SOURCE_DIR}/libs/tinyxml2/include)
set(TINYXML2_SOURCE_DIR ${PROJECT_SOURCE_DIR}/libs/tinyxml2/src)
add_library(${TINYXML2} STATIC EXCLUDE_FROM_ALL
	${TINYXML2_SOURCE_DIR}/tinyxml2.cpp

	${TINYXML2_HEADER_DIR}/tinyxml2.h
)
#set_target_properties(${TINYXML2} PROPERTIES
#	LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/libs/tinyxml2/lib
#)
set_target_properties(${TINYXML2} PROPERTIES
	COMPILE_DEFINITIONS_DEBUG "DEBUG;_DEBUG_;__DEBUG__;_DEBUG;DEBUG_"
)
target_include_directories(${TINYXML2} PUBLIC
	${PROJECT_SOURCE_DIR}/libs/tinyxml2/include
)

#
# sdk
#
set(SDK_HEADER_DIR ${PROJECT_SOURCE_DIR}/sdk/include)
set(SDK_SOURCE_DIR ${PROJECT_SOURCE_DIR}/sdk/src)
add_library(${SDK} STATIC EXCLUDE_FROM_ALL
	${SDK_SOURCE_DIR}/filecfg.cpp
	${SDK_SOURCE_DIR}/logdlg.cpp
	${SDK_SOURCE_DIR}/util.cpp
	${SDK_SOURCE_DIR}/path.cpp
	${SDK_SOURCE_DIR}/lexer.cpp
	${SDK_SOURCE_DIR}/editor.cpp
	${SDK_SOURCE_DIR}/mgr.cpp
	${SDK_SOURCE_DIR}/pluginmgr.cpp
	${SDK_SOURCE_DIR}/cfgmgr.cpp
	${SDK_SOURCE_DIR}/lexermgr.cpp
	${SDK_SOURCE_DIR}/pluginsmgrdlg.cpp

	${SDK_HEADER_DIR}/filecfg.h
	${SDK_HEADER_DIR}/logdlg.h
	${SDK_HEADER_DIR}/util.h
	${SDK_HEADER_DIR}/path.h
	${SDK_HEADER_DIR}/lexer.h
	${SDK_HEADER_DIR}/editor.h
	${SDK_HEADER_DIR}/mgr.h
	${SDK_HEADER_DIR}/plugin.h
	${SDK_HEADER_DIR}/pluginmgr.h
	${SDK_HEADER_DIR}/cfgmgr.h
	${SDK_HEADER_DIR}/lexermgr.h
	${SDK_HEADER_DIR}/pluginsmgrdlg.h
)

target_include_directories(${SDK} PUBLIC
	${PROJECT_SOURCE_DIR}/libs/tinyxml2/include
	${PROJECT_SOURCE_DIR}
	${WX_INCLUDE_DIRS}
	${PROJECT_SOURCE_DIR}/libs/wxscintilla/include
)
if(WX_INSTALLED)
	set_target_properties(${SDK} PROPERTIES
		COMPILE_FLAGS "`wx-config --cflags`"
	)
else()
	set_target_properties(${SDK} PROPERTIES
		COMPILE_DEFINITIONS "_FILE_OFFSET_BITS=64;WXUSINGDLL;__WXGTK__"
	)
	set_target_properties(${SDK} PROPERTIES
		COMPILE_FLAGS "-pthread"
	)
endif()


#
# wxScintilla
#
set(WXSCINTILLA_SOURCE_DIR ${PROJECT_SOURCE_DIR}/libs/wxscintilla/src)
add_library(${WXSCINTILLA} SHARED EXCLUDE_FROM_ALL
	${WXSCINTILLA_SOURCE_DIR}/scintilla/include/ILexer.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/include/Platform.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/include/SciLexer.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/include/Scintilla.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/include/ScintillaWidget.h

	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexA68k.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexAbaqus.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexAda.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexAPDL.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexAsm.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexAsn1.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexASY.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexAU3.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexAVE.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexAVS.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexBaan.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexBash.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexBasic.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexBullant.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexCaml.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexCLW.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexCmake.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexCOBOL.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexCoffeeScript.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexConf.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexCPP.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexCrontab.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexCsound.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexCSS.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexD.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexECL.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexEiffel.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexErlang.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexEScript.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexFlagship.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexForth.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexFortran.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexGAP.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexGui4Cli.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexHaskell.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexHTML.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexInno.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexKix.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexLisp.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexLout.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexLua.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexMagik.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexMarkdown.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexMatlab.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexMetapost.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexMMIXAL.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexModula.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexMPT.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexMSSQL.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexMySQL.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexNimrod.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexNsis.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexOpal.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexOScript.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexOthers.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexPascal.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexPB.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexPerl.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexPLM.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexPO.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexPOV.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexPowerPro.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexPowerShell.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexProgress.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexPS.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexPython.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexR.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexRebol.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexRuby.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexScriptol.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexSmalltalk.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexSML.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexSorcus.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexSpecman.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexSpice.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexSQL.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexTACL.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexTADS3.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexTAL.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexTCL.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexTCMD.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexTeX.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexTxt2tags.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexVB.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexVerilog.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexVHDL.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexVisualProlog.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexers/LexYAML.cxx

	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/Accessor.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/Accessor.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/CharacterSet.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/CharacterSet.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/LexAccessor.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/LexerBase.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/LexerBase.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/LexerModule.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/LexerModule.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/LexerNoExceptions.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/LexerNoExceptions.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/LexerSimple.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/LexerSimple.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/OptionSet.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/PropSetSimple.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/PropSetSimple.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/SparseState.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/StyleContext.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/StyleContext.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/WordList.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/lexlib/WordList.h

	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/AutoComplete.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/AutoComplete.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/CallTip.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/CallTip.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Catalogue.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Catalogue.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/CellBuffer.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/CellBuffer.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/CharClassify.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/CharClassify.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/ContractionState.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/ContractionState.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Decoration.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Decoration.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Document.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Document.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Editor.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Editor.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/ExternalLexer.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/ExternalLexer.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/FontQuality.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Indicator.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Indicator.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/KeyMap.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/KeyMap.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/LineMarker.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/LineMarker.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Partitioning.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/PerLine.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/PerLine.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/PositionCache.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/PositionCache.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/RESearch.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/RESearch.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/RunStyles.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/RunStyles.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/ScintillaBase.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/ScintillaBase.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/SciTE.properties
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Selection.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Selection.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/SplitVector.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Style.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/Style.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/SVector.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/UniConversion.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/UniConversion.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/ViewStyle.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/ViewStyle.h
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/XPM.cxx
	${WXSCINTILLA_SOURCE_DIR}/scintilla/src/XPM.h

	${WXSCINTILLA_SOURCE_DIR}/PlatWX.cpp
	${WXSCINTILLA_SOURCE_DIR}/PlatWX.h
	${WXSCINTILLA_SOURCE_DIR}/ScintillaWX.cpp
	${WXSCINTILLA_SOURCE_DIR}/ScintillaWX.h
	${WXSCINTILLA_SOURCE_DIR}/wxscintilla.cpp
)
set_target_properties(${WXSCINTILLA} PROPERTIES
	LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/libs/wxscintilla/lib
)
target_include_directories(${WXSCINTILLA} PUBLIC
	${PROJECT_SOURCE_DIR}/libs/wxscintilla/include
	${PROJECT_SOURCE_DIR}/libs/wxscintilla/src
	${PROJECT_SOURCE_DIR}/libs/wxscintilla/src/scintilla/include
	${PROJECT_SOURCE_DIR}/libs/wxscintilla/src/scintilla/src
	${PROJECT_SOURCE_DIR}/libs/wxscintilla/src/scintilla/lexlib
	${PROJECT_SOURCE_DIR}/libs/wxscintilla/src/scintilla/lexers
	${WX_INCLUDE_DIRS}
)
if(WX_INSTALLED)
	set_target_properties(${WXSCINTILLA} PROPERTIES
		COMPILE_DEFINITIONS "SCI_LEXER;__WX__"
	)
	set_target_properties(${WXSCINTILLA} PROPERTIES
		COMPILE_FLAGS "`wx-config --cflags`"
	)
else()
	set_target_properties(${WXSCINTILLA} PROPERTIES
		COMPILE_DEFINITIONS "_FILE_OFFSET_BITS=64;WXUSINGDLL;__WXGTK__;SCI_LEXER;__WX__"
	)
	set_target_properties(${WXSCINTILLA} PROPERTIES
		COMPILE_FLAGS "-pthread"
	)
endif()


#
# alliance
#
set(ALLIANCE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/plugins/alliance/src)
set(ALLIANCE_HEADER_DIR ${PROJECT_SOURCE_DIR}/plugins/alliance/include)
add_library(${ALLIANCE} SHARED EXCLUDE_FROM_ALL
    ${ALLIANCE_SOURCE_DIR}/main.cpp
	${ALLIANCE_SOURCE_DIR}/createprjdlg.cpp
	${ALLIANCE_SOURCE_DIR}/projectmgr.cpp
	${ALLIANCE_SOURCE_DIR}/path.cpp
	${ALLIANCE_SOURCE_DIR}/project.cpp
	${ALLIANCE_SOURCE_DIR}/tool.cpp
	${ALLIANCE_SOURCE_DIR}/projectstree.cpp
	${ALLIANCE_SOURCE_DIR}/alliancemenu.cpp
	${ALLIANCE_SOURCE_DIR}/createfiledlg.cpp
	${ALLIANCE_SOURCE_DIR}/argumentctrl.cpp
	${ALLIANCE_SOURCE_DIR}/envarpanel.cpp
	${ALLIANCE_SOURCE_DIR}/optionctrl.cpp
	${ALLIANCE_SOURCE_DIR}/toolpanel.cpp
	${ALLIANCE_SOURCE_DIR}/buildoptionsdlg.cpp
	${ALLIANCE_SOURCE_DIR}/toolctrl.cpp
	${ALLIANCE_SOURCE_DIR}/processmgr.cpp
	${ALLIANCE_SOURCE_DIR}/logmgr.cpp
	${ALLIANCE_SOURCE_DIR}/FileCreator.cpp
    ${ALLIANCE_SOURCE_DIR}/FileSelector.cpp
    ${ALLIANCE_SOURCE_DIR}/viewerdialog.cpp

    ${ALLIANCE_HEADER_DIR}/main.h
	${ALLIANCE_HEADER_DIR}/createprjdlg.h
	${ALLIANCE_HEADER_DIR}/projectmgr.h
	${ALLIANCE_HEADER_DIR}/path.h
	${ALLIANCE_HEADER_DIR}/project.h
	${ALLIANCE_HEADER_DIR}/tool.h
	${ALLIANCE_HEADER_DIR}/projectstree.h
	${ALLIANCE_HEADER_DIR}/alliancemenu.h
	${ALLIANCE_HEADER_DIR}/createfiledlg.h
	${ALLIANCE_HEADER_DIR}/argumentctrl.h
	${ALLIANCE_HEADER_DIR}/envarpanel.h
	${ALLIANCE_HEADER_DIR}/optionctrl.h
	${ALLIANCE_HEADER_DIR}/toolpanel.h
	${ALLIANCE_HEADER_DIR}/buildoptionsdlg.h
	${ALLIANCE_HEADER_DIR}/toolctrl.h
	${ALLIANCE_HEADER_DIR}/processmgr.h
	${ALLIANCE_HEADER_DIR}/logmgr.h
	${ALLIANCE_HEADER_DIR}/FileCreator.h
	${ALLIANCE_HEADER_DIR}/FileSelector.h
	${ALLIANCE_HEADER_DIR}/viewerdialog.h
)
set_target_properties(${ALLIANCE} PROPERTIES
	LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/plugins
)
target_include_directories(${ALLIANCE} PUBLIC
	${PROJECT_SOURCE_DIR}/libs/tinyxml2/include
	${WX_INCLUDE_DIRS}
	${PROJECT_SOURCE_DIR}/libs/wxscintilla/include
	${PROJECT_SOURCE_DIR}
	${PROJECT_SOURCE_DIR}/plugins
)
if(WX_INSTALLED)
	set_target_properties(${ALLIANCE} PROPERTIES
		COMPILE_FLAGS "`wx-config --cflags`"
	)
else()
	set_target_properties(${ALLIANCE} PROPERTIES
		COMPILE_DEFINITIONS "_FILE_OFFSET_BITS=64;WXUSINGDLL;__WXGTK__;SCI_LEXER;__WX__"
	)
	set_target_properties(${ALLIANCE} PROPERTIES
		COMPILE_FLAGS "-pthread"
	)
endif()



#
# ideall
#
set(IDEALL_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)
set(IDEALL_HEADER_DIR ${PROJECT_SOURCE_DIR}/include)
add_executable( ${IDEALL}
	${IDEALL_SOURCE_DIR}/iaAboutDialog.cpp
	${IDEALL_SOURCE_DIR}/iaDialogManager.cpp
	${IDEALL_SOURCE_DIR}/iaEditorManager.cpp
	${IDEALL_SOURCE_DIR}/iaFindDialog.cpp
	${IDEALL_SOURCE_DIR}/iaFindDialogBase.cpp
	${IDEALL_SOURCE_DIR}/iaMain.cpp
	${IDEALL_SOURCE_DIR}/iaMainFrame.cpp
	${IDEALL_SOURCE_DIR}/iaManager.cpp
	${IDEALL_SOURCE_DIR}/iaReplaceDialog.cpp
	${IDEALL_SOURCE_DIR}/iaSettingsEditorDialog.cpp

	${IDEALL_HEADER_DIR}/iaAboutDialog.h
	${IDEALL_HEADER_DIR}/iaDialogManager.h
	${IDEALL_HEADER_DIR}/iaEditorManager.h
	${IDEALL_HEADER_DIR}/iaFindDialog.h
	${IDEALL_HEADER_DIR}/iaFindDialogBase.h
	${IDEALL_HEADER_DIR}/iaMain.h
	${IDEALL_HEADER_DIR}/iaMainFrame.h
	${IDEALL_HEADER_DIR}/iaManager.h
	${IDEALL_HEADER_DIR}/iaReplaceDialog.h
	${IDEALL_HEADER_DIR}/iaSettingsEditorDialog.h
)
set_target_properties(${IDEALL} PROPERTIES
	RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}
)
#set_target_properties(${IDEALL} PROPERTIES LINK_FLAGS "-rdynamic")
if(WX_INSTALLED)
	set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-rpath,./libs/wxscintilla/lib")
	set_target_properties(${IDEALL} PROPERTIES
		COMPILE_FLAGS "`wx-config --cflags`"
	)
	execute_process(COMMAND wx-config --libs OUTPUT_VARIABLE WX_LIBS_TEMP)
	string(STRIP ${WX_LIBS_TEMP} WX_LIBS)
	set(WX_LINK_LIBS ${WX_LIBS})
else()
	set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-rpath,./libs/wx-2.9.5/lib -Wl,-rpath,./libs/wxscintilla/lib")
	set_target_properties(${IDEALL} PROPERTIES
		COMPILE_DEFINITIONS "_FILE_OFFSET_BITS=64;WXUSINGDLL;__WXGTK__"
	)
	set_target_properties(${IDEALL} PROPERTIES
		COMPILE_FLAGS "-pthread"
	)
	set(WX_LINK_LIBS
		wx_gtk2u_xrc-2.9
		wx_gtk2u_html-2.9
		wx_gtk2u_qa-2.9
		wx_gtk2u_adv-2.9
		wx_gtk2u_core-2.9
		wx_gtk2u_aui-2.9
		wx_baseu_xml-2.9
		wx_baseu_net-2.9
		wx_baseu-2.9
	)
endif()
target_link_libraries(${IDEALL}
	${WX_LINK_LIBS}
	${WXSCINTILLA}
	${SDK}
	${TINYXML2}
)
target_include_directories(${IDEALL} PUBLIC
	${PROJECT_SOURCE_DIR}/include
	${WX_INCLUDE_DIRS}
	${PROJECT_SOURCE_DIR}/plugins
	${PROJECT_SOURCE_DIR}
	${PROJECT_SOURCE_DIR}/libs/tinyxml2/include
)

